package com.hrt.datasender.mq.model;

import java.util.Date;

/**
 * 串口数据消息体
 * 
 * @author gislin
 *
 */
public class SerialModel extends MqModel {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    private Date dataTime;

    private byte[] data;

    private String comNum;

    private String deviceNum;

    public SerialModel(byte[] data, String comNum, String deviceNum) {
        dataTime = new Date();
        this.data = data;
        this.comNum = comNum;
        this.deviceNum = deviceNum;
    }

    @Override
    public int getMqModelType() {
        return MqModel.MODEL_TYPE_DRIVE;
    }

    @Override
    public String toString() {

        StringBuffer strBuf = new StringBuffer();

        for (byte b : data) {
            strBuf.append(b);
        }

        return "SerialModel [msg=" + strBuf + "]";
    }

    public String getComNum() {
        return comNum;
    }

    public void setComNum(String comNum) {
        this.comNum = comNum;
    }

    public Date getDataTime() {
        return dataTime;
    }

    public void setDataTime(Date dataTime) {
        this.dataTime = dataTime;
    }

    public byte[] getData() {
        return data;
    }

    public void setData(byte[] data) {
        this.data = data;
    }

    public String getDeviceNum() {
        return deviceNum;
    }

    public void setDeviceNum(String deviceNum) {
        this.deviceNum = deviceNum;
    }

}
